/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Testing;

import DAO.StatusDAO;
import DAO.TagDAO;
import POJO.CounterPOJO;
import POJO.StatusPOJO;
import POJO.TagPOJO;
import POJO.UserPOJO;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
import ServicesAccessData.Admin;
import ServicesAccessData.UserAdminPOJO;
import java.util.List;


/**
 *
 * @author huy
 */
public class NonblockingClientAdmin {

    private void invoke() {
        TTransport transport;
        try {
            transport = new TFramedTransport(new TSocket("localhost", 7912));
            TProtocol protocol = new TBinaryProtocol(transport);

            Admin.Client client = new Admin.Client(protocol);
            transport.open();

            /*Gọi các phương thức trong service tại đây*/
            //System.out.println(client.getListPaging(10));
            //System.out.println(client.selectStatusFromPage("987d2fd0-7270-4dc2-9c30-e93a9b08c5ad", 10));
            //System.out.println(client.deleteStatus("987d2fd0-7270-4dc2-9c30-e93a9b08c5ad"));
            
            //client.insertTag("tagtest", true);
            //client.insertStatusIntoTag("tagtest", "testinsert");
            //List<UserPOJO> listUser =  client.selectListAdminUser();
            //System.out.println(listUser);
//            List<StatusPOJO> counter = client.searchStatusByContentandTag("vui","vui", "0", "10", "0");
            //System.out.println(counter);
            //StatusPOJO status = new StatusPOJO("testinsert", "Toi la ty phu", "tagtest", "05/07/2012", "05/07/2017", true);
            //client.insertStatus(status);
            //System.out.println();
            //System.out.println(client.selectStatusWithID("987d2fd0-7270-4dc2-9c30-e93a9b08c5ad"));
            //boolean result = client.updateTagsOnAStatus("01234567", "Toi chac chan la ty phu vao nam 2017");
            //client.updateIsPublicOnATag("khon nan", true);
//            System.out.println(client.selectTagWithTagName("cuộc sống"));
//            System.out.println(result);
            
//            List<UserPOJO> listUser = client.selectListUserFromPage("12024556", 10);
//            System.out.println(listUser);
            
//            List<String> listPagingUser = client.getListPagingOnATag("cuộc sống", 5);
//            System.out.println(listPagingUser);
            
//            
//            System.out.println(client.selectStatusFromPageOnATag("cuộc sống", "1032", 5));
//           System.out.println(client.setUserAdmin("tienAdmin2", "123456"));
//          System.out.println(client.setUserAdmin("tienAdmin3", "123456"));
           //System.out.println(client.getUserAdmin("tienAdmin"));
//            client.updateTagsOnAStatus("0", "vui vẻ,châm biếm");
           
//            List<UserAdminPOJO> listUser = client.getListUserAdminPOJO();
//            System.out.println(listUser);
//            
//            client.removeUserAdmin("tienAdmin2");
//            listUser = client.getListUserAdminPOJO();
//            System.out.println(listUser);            
            transport.close();
        } catch (TTransportException e) {
        } catch (TException e) {
        }
    }
    public static void main(String[] args) {
        NonblockingClientAdmin c = new NonblockingClientAdmin();
        c.invoke();
    }
}